#include "App.h"
#include "AppStateManager.h"
#include "Parameters.h"

App::App() : appStateManager_(0)
{
    //
}

App* App::GetInstance()
{
    static App app;
    return &app;
}

void App::Execute()
{
    //load parameters:
    Parameters::Load();

    //create window:
    mainWindow_.create(sf::VideoMode(Parameters::GetScreenWidth(), Parameters::GetScreenHeight(), 32),
                       "Mandelbrot viewer", sf::Style::Resize | sf::Style::Close);

    mainWindow_.resetGLStates();

    appStateManager_ = AppStateManager::GetInstance();
    appStateManager_->SetActiveAppState(AppState::SplashScreen);

    //main loop:
    while (mainWindow_.isOpen())
    {
        appStateManager_->OnLoop(mainWindow_);
        sf::sleep(sf::milliseconds(50));
    }
}







